#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/mman.h>
#include <math.h>
#include <getopt.h>

#ifndef _COMMON_H_
#define _COMMON_H_

#define _SUCCESS_	0
#define _FAILURE_ 	1

// on MacOS, clang might not recognize uint
#ifndef uint32_t
	typedef unsigned int uint32_t;
#endif

#ifndef uint
	typedef uint32_t uint;
#endif


void delay(uint delay_max);

void print_as_bin(uint x);
void printf_bin(int num);
void printf_bin16(int num);
void fprintf_bin16(FILE *fp, int num);

void read_bin_text();

uint swap_endian(uint a);


#endif

